/**
 * Licensee: DuKe TeAm
 * License Type: Purchased
 */
package ormsamples;

import org.orm.*;
public class ListEvaluacionDocenteData {
	private static final int ROW_COUNT = 100;
	
public void listTestData() throws PersistentException {
		orm.DAOFactory lDAOFactory = orm.DAOFactory.getDAOFactory();
		System.out.println("Listing Evaluacion...");
		orm.Evaluacion[] ormEvaluacions = lDAOFactory.getEvaluacionDAO().listEvaluacionByQuery(null, null);
		int length = Math.min(ormEvaluacions.length, ROW_COUNT);
		for (int i = 0; i < length; i++) {
			System.out.println(ormEvaluacions[i]);
		}
		System.out.println(length + " record(s) retrieved.");
		
		System.out.println("Listing Region...");
		orm.Region[] ormRegions = lDAOFactory.getRegionDAO().listRegionByQuery(null, null);
		length = Math.min(ormRegions.length, ROW_COUNT);
		for (int i = 0; i < length; i++) {
			System.out.println(ormRegions[i]);
		}
		System.out.println(length + " record(s) retrieved.");
		
		System.out.println("Listing Comuna...");
		orm.Comuna[] ormComunas = lDAOFactory.getComunaDAO().listComunaByQuery(null, null);
		length = Math.min(ormComunas.length, ROW_COUNT);
		for (int i = 0; i < length; i++) {
			System.out.println(ormComunas[i]);
		}
		System.out.println(length + " record(s) retrieved.");
		
	}
	
	public void listByCriteria() throws PersistentException  {
		System.out.println("Listing Evaluacion by Criteria...");
		orm.EvaluacionCriteria evaluacionCriteria = new orm.EvaluacionCriteria();
		// Please uncomment the follow line and fill in parameter(s) 
		//evaluacionCriteria.ev_id.eq();
		evaluacionCriteria.setMaxResults(ROW_COUNT);
		orm.Evaluacion[] ormEvaluacions = evaluacionCriteria.listEvaluacion();
		int length =ormEvaluacions== null ? 0 : Math.min(ormEvaluacions.length, ROW_COUNT); 
		for (int i = 0; i < length; i++) {
			 System.out.println(ormEvaluacions[i]);
		}
		System.out.println(length + " Evaluacion record(s) retrieved."); 
		
		System.out.println("Listing Region by Criteria...");
		orm.RegionCriteria regionCriteria = new orm.RegionCriteria();
		// Please uncomment the follow line and fill in parameter(s) 
		//regionCriteria.re_numeroregion.eq();
		regionCriteria.setMaxResults(ROW_COUNT);
		orm.Region[] ormRegions = regionCriteria.listRegion();
		length =ormRegions== null ? 0 : Math.min(ormRegions.length, ROW_COUNT); 
		for (int i = 0; i < length; i++) {
			 System.out.println(ormRegions[i]);
		}
		System.out.println(length + " Region record(s) retrieved."); 
		
		System.out.println("Listing Comuna by Criteria...");
		orm.ComunaCriteria comunaCriteria = new orm.ComunaCriteria();
		// Please uncomment the follow line and fill in parameter(s) 
		//comunaCriteria.co_id.eq();
		comunaCriteria.setMaxResults(ROW_COUNT);
		orm.Comuna[] ormComunas = comunaCriteria.listComuna();
		length =ormComunas== null ? 0 : Math.min(ormComunas.length, ROW_COUNT); 
		for (int i = 0; i < length; i++) {
			 System.out.println(ormComunas[i]);
		}
		System.out.println(length + " Comuna record(s) retrieved."); 
		
	}
	
	public static void main(String[] args) {
		try {
			ListEvaluacionDocenteData listEvaluacionDocenteData = new ListEvaluacionDocenteData();
			try {
				listEvaluacionDocenteData.listTestData();
				//listEvaluacionDocenteData.listByCriteria();
			}
			finally {
				orm.EvaluacionDocentePersistentManager.instance().disposePersistentManager();
			}
		}
		catch (Exception e) {
			e.printStackTrace();
		}
	}
}
